package openjdk.collections;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

/**
 * Created by boot on 1/15/16.
 */
public class TestIterator {
    public static void main(String[] args) {
        List<String> lst = new ArrayList<String>();
        for (int i = 0; i < 10; i++) {
            String s = i + "";
            lst.add(s);
        }

        System.out.println(lst.size() + " start");
        System.out.println("#######################");
        Iterator<String> it = lst.iterator();
        while (it.hasNext()) {
            System.out.println(it.next());
            it.remove();
        }

        System.out.println("====================");
        System.out.println(lst.size() + " unit");
        System.out.println("=========== 再次输出 ============");
        for (int i = 0; i < lst.size(); i++) {
            System.out.println(lst.get(i));
        }
    }
}
